package com.dlc.shop.systemtest.data.amount;

import com.dlc.shop.bean.model.Area;
import com.dlc.shop.delivery.common.model.Transfee;
import com.dlc.shop.delivery.common.model.TransfeeFree;
import com.dlc.shop.delivery.common.model.Transport;
import com.dlc.shop.systemtest.api.amount.AreaApi;

import java.util.Arrays;

/**
 * @author lanhai
 */
public class TransportData {
    public static Transport getTransport(Double firstPiece,Double firstFee,Double continuousPiece,Double continuousFee){
        Transport transport = new Transport();
        transport.setChargeType(0);
        transport.setHasFreeCondition(1);
        transport.setIsFreeFee(0);
        transport.setTransName("接口测试运费模板");

        TransfeeFree transfeeFree = new TransfeeFree();
        Area area = new Area();
        area.setAreaId(440113L);
        area.setAreaName("番禺区");
        area.setLevel(3);
        area.setParentId(4401L);
        area.setAreas(null);
        area.setMaxGrade(null);
        transfeeFree.setFreeCityList(Arrays.asList(area));
        transfeeFree.setFreeType(0);
        transfeeFree.setPiece(1D);
        transport.setTransfeeFrees(Arrays.asList(transfeeFree));

        Transfee transfee = new Transfee();
        transfee.setCityList(AreaApi.list(null));
        transfee.setContinuousFee(continuousFee);
        transfee.setContinuousPiece(continuousPiece);
        transfee.setFirstFee(firstFee);
        transfee.setFirstPiece(firstPiece);
        transport.setTransfees(Arrays.asList(transfee));
        return transport;
    }
}
